<?php

namespace PAT\ProductBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * PAT\ProductBundle\Entity\Category
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="PAT\ProductBundle\Entity\CategoryRepository")
 */
class Category
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;
	
	/**
	 * @ORM\ManyToOne(targetEntity="PAT\ProductBundle\Entity\Category")
     */
	 private $categoryParent;
	 
	 /**
     * @ORM\OneToMany(targetEntity="PAT\ProductBundle\Entity\Product", mappedBy="category")
     */
	 private $products;
	 
	 /**
	  * @ORM\OneToOne(targetEntity="PAT\ProductBundle\Entity\Picture")
	  */
	 private $picture;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Category
     */
    public function setName($name)
    {
        $this->name = $name;
    
        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set categoryParent
     *
     * @param PAT\ProductBundle\Entity\Category $categoryParent
     * @return Category
     */
    public function setCategoryParent(\PAT\ProductBundle\Entity\Category $categoryParent = null)
    {
        $this->categoryParent = $categoryParent;
    
        return $this;
    }

    /**
     * Get categoryParent
     *
     * @return PAT\ProductBundle\Entity\Category 
     */
    public function getCategoryParent()
    {
        return $this->categoryParent;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->products = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Add products
     *
     * @param PAT\ProductBundle\Entity\Product $products
     * @return Category
     */
    public function addProduct(\PAT\ProductBundle\Entity\Product $products)
    {
        $this->products[] = $products;
		$products->setCategory($this);
        return $this;
    }

    /**
     * Remove products
     *
     * @param PAT\ProductBundle\Entity\Product $products
     */
    public function removeProduct(\PAT\ProductBundle\Entity\Product $products)
    {
        $this->products->removeElement($products);
		$products->setCategory(null);
    }

    /**
     * Get products
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getProducts()
    {
        return $this->products;
    }
    
    
    /**
     * Set picture
     *
     * @param PAT\ProductBundle\Entity\Picture $picture
     * @return Product
     */
    public function setPicture(\PAT\ProductBundle\Entity\Picture $picture = null)
    {
    	$this->picture = $picture;
    
    	return $this;
    }
    
    /**
     * Get picture
     *
     * @return PAT\ProductBundle\Entity\Picture
     */
    public function getPicture()
    {
    	return $this->picture;
    }
    
    
}